﻿@{
    ViewBag.Title = "ShowProject";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@*<script>
    $(document).ready(function () {
        show(1);
    });
    function show()
    {
        $.ajax({
            type: "get",
            url: "/Home/ProJectShows",
            success: function (data) {
                $(data.dblist).each(function (i, obj) {
                    var tr = "<tr><td>" + obj.Id + "</td><td>" + obj.ProjectType + "</td><td>" + obj.ProjectName + "</td><td>" + obj.YesAccredit + "</td><td>" + obj.DeclareTime + "</td><td>" + obj.Area + "</td><td>" + obj.Name + "</td><td>" + obj.ProjectState + "</td></tr>";
                    $("#tab tbody").append(tr);
                });
                var a = "<a onclick='show(1)'>首页</a>"
                if (data.pageindex - 1 > 0) {
                    var a1 = "<a onclick='show(" + (data.pageindex - 1) + ")'>上一页</a>"
                }
                if (data.pageindex < data.dbcount) {
                    var a2 = "<a onclick='show(" + (data.pageindex + 1) + ")'>下一页</a>"
                }
                a3 = "<a onclick='show(" + data.dbcount + ")'>尾页</a>"
                $("#page tr td").append(a);
                $("#page tr td").append(a1);
                $("#page tr td").append(a2);
                $("#page tr td").append(a3);
            }
        });
    }
</script>*@

<script>
    $(document).ready(function () {
        show(1);
    });
    function show(i) {
        $("#page tr td").empty();
        $("#file tbody").empty();
        $.ajax({
            type: "get",
            url: "/Home/showfile",
            data: {
                "index": i,
                "size": 10
            },
            success: function (data) {
                $(data.dblist).each(function (i, obj) {
                    var tr = "<tr><td>" + obj.fid + "</td><td>" + obj.filename + "</td><td>" + obj.FileTyep + "</td><td>" + obj.ProjectName + "</td><td>" + obj.Name + "</td><td>" + obj.fileDate + "</td><td><a href='/Home/downfile?filepath=" + obj.filename + "'>下载</a></td></tr>"
                    $("#file tbody").append(tr);
                })
                var a = "<a onclick='show(1)'>首页</a>"
                if (data.pageindex - 1 > 0) {
                    var a1 = "<a onclick='show(" + (data.pageindex - 1) + ")'>上一页</a>"
                }
                if (data.pageindex < data.dbcount) {
                    var a2 = "<a onclick='show(" + (data.pageindex + 1) + ")'>下一页</a>"
                }
                a3 = "<a onclick='show(" + data.dbcount + ")'>尾页</a>"
                $("#page tr td").append(a);
                $("#page tr td").append(a1);
                $("#page tr td").append(a2);
                $("#page tr td").append(a3);
            }
        })
    }
</script>


@*<h2>Show Project</h2>
<div>
    <table class="table table-striped" id="tab">
        <thead>
            <tr>
                <th>项目编号</th>
                <th>项目类型</th>
                <th>项目名称</th>
                <th>是否授权</th>
                <th>申请时间</th>
                <th>所属区域</th>
                <th>项目负责人</th>
                <th>状态</th>
            </tr>
        </thead>
        <tbody></tbody>
    </table>
</div>*@
<div>
    <table id="file" class="table table-condensed">
        <thead>
            <tr>
                <th>文件编号</th>
                <th>文件名称</th>
                <th>文件类型</th>
                <th>项目名称</th>
                <th>上传者</th>
                <th>上传时间</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody></tbody>
    </table>
    <table id="page" class="table table-condensed">
        <tr align="center">
            <td></td>
        </tr>
    </table>

</div>